package com.zhanghp;

import com.zhanghp.object.Accountant;
import com.zhanghp.object.Employee;
import com.zhanghp.object.Leader;
import com.zhanghp.visitor.ConfigureAccountantVisitor;
import com.zhanghp.visitor.ConfigureEmployeeVisitor;
import com.zhanghp.visitor.ConfigureLeaderVisitor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zhanghp
 * @date 2022-08-16 16:36
 */
@Slf4j
public class App {
    public static void main(String[] args) {
        // 访问者
        var conLeader = new ConfigureLeaderVisitor();
        var conEmployee = new ConfigureEmployeeVisitor();
        var conAccoutant = new ConfigureAccountantVisitor();

        // 元素
        var leader = new Leader();
        var employee = new Employee();
        var accountant = new Accountant();

        // 访问
        log.info("leader visitor start");
        leader.accept(conLeader);
        employee.accept(conLeader);
        accountant.accept(conLeader);

        log.info("employee visitor start");
        leader.accept(conEmployee);
        employee.accept(conEmployee);
        accountant.accept(conEmployee);

        log.info("accountant visitor start");
        leader.accept(conAccoutant);
        employee.accept(conAccoutant);
        accountant.accept(conAccoutant);


    }
}
